<?php

class m_website_actions_block_modal_BlockInfosAction extends m_backoffice_extends_FormModal
{
	public function execute()
	{
		$page = $this->getDocumentFromRequest();

        /* @var $page m_website_documents_Page */

        $blockId = $this->getRequestParameter('blockId');

        if(strlen($blockId) >= 64)
        {
            $block = unserialize(base64_decode($blockId));
        }
        else
        {
            $block = $page->getBlockById($blockId);
        }

        $blockParams = $block;

        unset($blockParams['blockId']);

        $blockParams['blockLabel'] = str_replace("'", '', $blockParams['blockLabel']);

        $smartyBlock = $page->arrayToSmartyBlock($blockParams);

        $this->addToModel('blockParams', $block);
        $this->addToModel('smartyBlock', $smartyBlock);

        $this->setView('success');
    }
}